﻿using System;

namespace Tree
{
    class DivideNode : BiNode
    {
        public DivideNode(Node Left, Node Right)
            : base(Left, Right)
        {
        }
        //public override double Calc()
        //{
        //    return _pLeft.Calc() * _pRight.Calc();
        //}
        public override double Result
        {
            get
            {
                double x = _pRight.Result;
                if (x == 0.0)
                {
                    Console.WriteLine("Divide by Zero!");
                    return int.MaxValue;
                }
                return _pLeft.Result / x;
            }
        }
    }
}